package com.tarena.lbs.common.exception;

import com.tarena.lbs.base.protocol.exception.BusinessException;
import com.tarena.lbs.base.protocol.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler
    public Result<Void> doHandlerBusinessException(BusinessException ex) {
        log.error("异常处理:{}", ex.getMessage());
        return new Result<>(ex.getCode(), ex.getMessage(),null);
    }
}
